<?php if(get_template_type() == 'index'){?>
    <div class="pd-wrap fix">
        <div class="product_intro">
            <div class="product-name" id="bfdProductTitle">
            <?php echo $output['goods']['goods_name']; ?></div>
            <div class="product-wrap fix">
                <div class="product_preview">
                    
<style type="text/css">
.zoom-section{clear:both; }
*html .zoom-section{display:inline;clear:both;}
.zoom-desc{width:383px; padding:12px 0px; height:60px; overflow:hidden;}
.zoom-desc p{ width:450px;  overflow:hidden; }
.zoom-desc a{ float:left; width:47px; height:47px;border-radius:2px;  display:block; border:1px solid #dad8d9; margin-right:10px; background:#fff;overflow:hidden;}
.zoom-desc a img{max-width:100%;}
.zoom-desc a.hover{border:2px solid #598ee4;}
.zoom-small-image{float:left;position:relative;  width:383px; height:383px; /*border:1px solid #d9d9d9;*/ background:#fff;  }
.zoom-small-image a{ height:383px; }
.zoom-tiny-image{margin:0px;}
.zoom-tiny-image:hover{border:1px solid #cc000;}
.zoom-small-image table{table-layout:fixed;}
#ProductDetails_common_ProductImages___imgBig{max-width:383px !important;}
.my_left_category{
    display: none !important;
}
.nch-breadcrumb-layout{
    display: none !important;
}
/*._jmyp .product-des .num-wrap .num-bar > *{
    width: 23px !important;
}*/
.Product_input{
    padding: 0 !important;
}
._jmyp #addcartButton:hover{
    text-decoration: none;
}
._jmyp .pd-wrap{
    width: 1200px;
    margin:0 auto;
}
._jmyp .tde-wrap{
    width: 1200px;
    margin:0 auto;
}
</style>
<table cellpadding="0" cellspacing="0" border="0">
<?php //print_r($output['goods']);exit;?>
    <tr class="product_preview3">
        <td>        
            <div class="zoom-section">
                <div class="zoom-section">
                    <div class="zoom-small-image">
                        <a id="zoom1" class="cloud-zoom" rel="adjustX:10, adjustY:-4" title="<?php echo $output['goods']['goods_name']; ?>" href="/Storage/master/product/images/508c1f68fbb2427583bbc55abb194c54.jpg">
                            <table cellspacing="0" cellpadding="0" border="0" width="100%" height="100%">
                                <tr>
                                    <td align="center" valign="middle">
                                        <img id="ProductDetails_common_ProductImages___imgBig" title="Optional title display" src="/data/upload/shop/store/goods/<?php echo $output['goods']['store_id'];?>/<?php echo $output['goods']['goods_image'];?>" style="border-width:0px;" />
                                    </td>
                                </tr>
                            </table>
                        </a>                        
                    </div>
                    <div class="zoom-desc">
                        <p>
                        <?php
                           $pics = Model('goods_images')->where(array('goods_commonid' => $cmid))->order('goods_image_sort asc')->select();
                           foreach($pics as $key => $val){
                        ?>
                            <a id="ProductDetails_common_ProductImages___iptPicUrl1" class="cloud-zoom-gallery" title="<?php echo $output['goods']['goods_name']; ?>" rel="useZoom: 'zoom1', smallImage: '/data/upload/shop/store/goods/<?php echo $store?>/<?php echo $val['goods_image']?>'" href="/data/upload/shop/store/goods/<?php echo $store?>/<?php echo $val['goods_image']?>"><img id="ProductDetails_common_ProductImages___imgSmall1" alt="Thumbnail 1" src="/data/upload/shop/store/goods/<?php echo $store?>/<?php echo $val['goods_image']?>" style="border-width:0px;" /></a>
                        <?php 
                            }
                        ?>
                        </p>
                    </div>
                    </div>
                    
                </div>
        </td>
    </tr>
    <tr>
        <td height="10">
        </td>
    </tr>
   
</table>



                    <div class="fix">

                        <div class="addfav-wrap"><a id="addFavorite" href="javascript:collect_goods('<?php echo $output['goods']['goods_id']; ?>','count','goods_collect');" class="addfav-btn">收藏该商品</a></div>
                    </div>

                </div>
                <div class="product_parameter">
                    <div class="product-des des1">
                        <dl class="des-item fix">
                            <dt>单品价格</dt>
                            <dd>
                                <span class="pro-pram single-price">￥<span id="ProductDetails_lblBuyPrice"><?php
                                    echo $output['goods']['goods_price']; 
                                ?></span></span>
                                <?php
                                    if(!$output['goods']['open_tax']){
                                ?>
                                <span><label class="pro-label">税金</label><span class="pro-value">￥<?php echo $tax = cal_tax_ex($output['goods'])?></span></span>
                                <?php
                                    }
                                    else{

                                    }
                                ?>
                                <!-- <span><label class="pro-label">进口税</label><span class="pro-value"><span>10</span>%</span></span>
                                <span class="rate-tip">关税低于50元（含50），免征</span> -->
                            </dd>
                        </dl>
                        <dl class="des-item fix">
                            <dt>总金额</dt>
                            <dd>
                                <span class="pro-pram total-price">￥<strong><span id="productDetails_Total"><?php
                                    echo number_format($output['goods']['goods_price'] + $tax,2);
                                ?></span> </strong></span>
<!--                                <div class="view-rate">-->
<!--                                    <span style="cursor:pointer;">查看关税表</span>-->
<!--                                    <div class="rate-wrap">-->
<!--                                        <div class="rate-con">-->
<!--                                            <p>个人邮寄进境物品， 海关依法征收进口税，应征进口税税额在人民币50元（含50元）以下的海关予以免征，包裹货值每次限值1000元，税率为：奶粉10%，洗护50%，服装20%，食品10%，具体税率请查看<a class="link" href="helpItem.aspx?helpid=64" target="_blank">详情>></a></p>-->
<!--                                        </div>-->
<!--                                    </div>-->
<!--                                </div>-->
                            </dd>
                        </dl>
                    </div>
                    <div class="product-des des2">
                        <dl class="des-item fix">
                            <dt>累计成交</dt>
                            <dd><span class="mr20"><em><?php echo $output['goods']['goods_salenum'];?></em>件成交</span><span><em><?php echo $output['goods']['evaluation_count'];?></em>条评价</span></dd>
                        </dl>                                                                                                           
                        <dl class="des-item fix">
                            <dt>支付方式</dt>
                            <dd><span class="mr25">在线支付</span><!--<span>银行转帐</span>--></dd>
                        </dl>
                        <!-- <dl class="des-item fix">
                            <dt>配送方式</dt>
                            <dd><span>保税仓包邮</span></dd>
                        </dl>
                        <div id="ProductDetails_divProductBrief">
                            <dl class="des-item fix">
                                <dt>商品简介</dt>
                                <dd class="pro-intr"><span>适用阶段：（12-24个月宝宝) 800g/1罐</span></dd>
                            </dl>
                        </div> -->
                        <dl class="des-item fix">
                            
                        </dl>
                    </div>
                    <div class="product-des last">                        
                        
                        <dl class="des-item fix">
                            <dt>数量</dt>
                            <dd>
                                <div class="num-wrap fix">
                                    <div class="num-con">
                                        <!--<input type="text" value="1" old-v="1">-->
                                        <span id="ProductDetails_txtBuyAmount" class="Product_input"><input min="1" max="<?php echo $output['goods']['goods_storage']; ?>" class="Product_input" id="buyAmount" type="number" value="1" style="width:30px;" /><input id="oldBuyNumHidden" type="hidden" value="1"  /></span>
                                    </div>

<script >
//    $('.btn-add').click(function() {
//        var max = $('#productDetails_Stock').html();
//        $('#buyAmount')[0].value++;
//        if($('#buyAmount')[0].value > max){
//            $('#buyAmount')[0].value = max;
//            $(this).addClass('disabled');
//            $('.btn-reduce').removeClass('disabled')
//        }
//
//    });

</script>
                                </div>
                                <div class="ovh">

                                    <div style="display:none;">
                                        <input type="hidden" id="hiddenIsLogin" value="nologin" /><span id="buyButton"><img src="/shop/templates/haidao/pictures/mai_buttom_btn.jpg" /></span>
                                    </div><span class="stock"><span class="mr5"><span id="productDetails_Stock" nctype="goods_stock"><?php echo $output['goods']['goods_storage'];?></span></span>件可售&nbsp;<span id="buyCardinalityTip" title="您购买该商品的数量必须为购买基数的整数倍" style="cursor:pointer;color:#ff0000;"></span></span>                                    
                                </div>
                            </dd>
                        </dl>
                        <dl class="des-item fix">
                            <dt></dt>
                            <dd class="pos-rt">
                            	<div class="success-tip" id="success-tip">+1</div>
                                <a id="ProductDetails_nowBuyBtn" nctype="buynow_submit" class="buy-btn buynow">立即购买</a><a href="javascript:void(0);" nctype="addcart_submit" id="addcartButton">加入购物车</a>
                                <div class="gd-code-wrap fix" style="display:none;">
                                	<!-- <div class="fix">
                                        <div class="gd-code-left"><img src="/shop/templates/haidao/pictures/qcode_1572_20160203140337198.jpg" id="ProductDetails_productImg" class="gd-code-img" /></div>
                                        <div class="gd-code-right">
                                            <p>立刻扫码手机购买</p>
                                            <p>立享手机优惠价</p>
                                        </div>
                                    </div> -->
                                </div>
                               
                            </dd>
                        </dl>
                    </div>

                    <div style="display:none;">
                        <div class="imporsourceTypediv">
                            <img id="ProductDetails_imgIcon" class="imporsourceType-img" src="/shop/templates/haidao/pictures/3cca1d5fe4d14e0faa4a0e483e1f8b00.png" style="border-width:0px;" />
                            &nbsp;&nbsp;<span class="litCnArea">荷兰</span>
                        </div>
                        <div>商品编号：<span id="bfdProductCode">1021-HENU004</span></div>
                        <div>售        价：<b>￥<span></span></b></div>
                        
                        <div>市&nbsp;&nbsp;场&nbsp;&nbsp;价：<del>￥<span id="ProductDetails_lblMarkerPrice">0.00</span></del></div>
                        <div style=" display:none;">品牌：<span id="bfdBrand">Nutrilon牛栏</span></div>
                        <div style=" display:none;">商品货号：<span><span id="productDetails_sku">HENU004*2</span><input id="productDetails_sku_v" name="productDetails_sku_v" type="hidden" value="1572_0" /></span></div>
                        <div style=" display:none;">浏览次数：<span>16829 次</span></div>
                        <div style=" display:none;">重量：<span><span id="ProductDetails_litWeight">1600.00 g</span></span></div>
                        <div style=" display:none;">已经出售：<span></span></div>

                    </div>

                </div>
            </div>
        </div>
    </div>
    <div style="height:10px; overflow:hidden;clear:both;"></div>
    <div class="tde-wrap fix">
        <div class="tde-left">
            <div class="pro-wrap">
                <h4>销量排行</h4>
                <div class="pro-list">
                <?php if(is_array($output['hot_sales']) && !empty($output['hot_sales'])){?>
                    <ul>  
                        <?php foreach($output['hot_sales'] as $val){?>                      
                        <li class="fix">
                        	<div class="pro-img">
                        		<a id="ProductDetails_list_Common_GoodsList_HotSale_ctl00_ctl00_ProductDetailsLink1" href="<?php echo urlShop('goods', 'index',array('goods_id'=>$val['goods_id']));?>" target="_blank"><img id="ProductDetails_list_Common_GoodsList_HotSale_ctl00_ctl00_Common_ProductThumbnail1" CustomToolTip="ProductName" src="<?php echo thumb($val, 240);?>" onload="javascript:DrawImage(this,100,100);"  style="border-width:0px;" /></a>
                        	</div>
                        	<div class="pro-info">
                        		<div class="pro-name"><a id="ProductDetails_list_Common_GoodsList_HotSale_ctl00_ctl00_ProductDetailsLink2" href="/product_detail-2105.aspx" target="_blank"><?php echo $val['goods_name']?></a></div>
                        		<div class="pro-price">¥<?php echo $val['goods_promotion_price']?></div>
                        	</div>
                        </li>
                        <?php }?>
                    </ul>
                    <?php }?>
                </div>
            </div>
            
            <!--         <div class="mt10">
                        <a><img src="/shop/templates/haidao/pictures/rp.jpg" /></a>
                    </div>
                     <div class="mt10">
                        <a><img src="/shop/templates/haidao/pictures/rp2.jpg" /></a>
                    </div> -->

        </div>
        <style>
            ._jmyp #ulProductreview li{
                padding: 0 !important;
            }
            ._jmyp .pagination{
                display: inline-block;
                float: none;
            }
        </style>
        <div class="tde-right">
            <div class="product_detail">
                <ul class="product_nav_wrap">
                    <li class="curr"><a>商品详情</a></li>
                    <li><a>商品评价(<?php echo $output['goods']['evaluation_count'];?>)</a></li>
                    <!--<li><a>成交记录</a></li>-->
                    <!--<li><a>商品咨询</a></li>-->
                </ul>

                <div class="product_mc">
                    <div class="pro-desc">
                        <table cellpadding="0" cellspacing="0" class="com-table"><tbody></tbody></table>  <!--海捣网使用新模版-->
                    </div>

                    <div style="overflow:hidden;height:auto">
                        <ul>
                            <!--原属性控件已去掉-->
                        </ul>
                    </div>

                    <?php if (isset($output['plate_top'])) {?>
                    <div class="top-template"><?php echo $output['plate_top']['plate_content']?></div>
                    <?php }?>
                    <div class="default"><?php echo $output['goods']['goods_body']; ?></div>
                    <?php if (isset($output['plate_bottom'])) {?>
                    <div class="bottom-template"><?php echo $output['plate_bottom']['plate_content']?></div>
                    <?php }?>

                </div>
                <div class="product_mc" style="display:none">
                	<div id="comment-percent" class="comment-percent">
                        <div class="progress progress1">好评度：</div>
                        <div class="progress progress2"><em><?php echo $output['goods_evaluate_info']['good_percent'];?></em>%</div>
                        <div class="progress progress3">
                        	<dl>
                                <dt>
                                    好评<span>(<?php echo $output['goods_evaluate_info']['good_percent'];?>%)</span>
                                </dt>
                                <dd>
                                    <div id="ProductDetails_divNiceDegree" style="width:<?php echo $output['goods_evaluate_info']['good_percent'];?>%"></div>
                                </dd>
                            </dl>
                            <dl>
                                <dt>
                                    中评<span>(<?php echo $output['goods_evaluate_info']['normal_percent'];?>%)</span>
                                </dt>
                                <dd>
                                    <div id="ProductDetails_divMidDegree" style="width:<?php echo $output['goods_evaluate_info']['normal_percent'];?>%"></div>
                                </dd>
                            </dl>
                            <dl>
                                <dt>
                                    差评<span>(<?php echo $output['goods_evaluate_info']['bad_percent'];?>%)</span>
                                </dt>
                                <dd>
                                    <div id="ProductDetails_divPoorDegree" style="width:<?php echo $output['goods_evaluate_info']['bad_percent'];?>%"></div>
                                </dd>
                            </dl>
                        </div>
                    </div>
                    <ul id="all-comments-title">
                        <li class="cur"><a href="javascript:;">全部评价<span>(<?php echo $output['goods_evaluate_info']['all'];?>)</span></a></li>
                        <li><a href="javascript:;">好评<span>(<?php echo $output['goods_evaluate_info']['good'];?>)</span></a></li>
                        <li><a href="javascript:;">中评<span>(<?php echo $output['goods_evaluate_info']['normal'];?>)</span></a></li>
                        <li><a href="javascript:;">差评<span>(<?php echo $output['goods_evaluate_info']['bad'];?>)</span></a></li>
                    </ul>
                    <ul id="ulProductreview">
                    	<!-- <h2>
                            <span class="comment-span1">评价心得</span>
                            <span class="comment-span2">顾客满意度</span>
                            <span class="comment-span3">购买信息</span>
                            <span class="comment-span4">评论者</span>
                        </h2> -->
                        <!-- 商品评价内容部分 -->
                        <div id="goodseval" class="ncs-commend-main"></div>     
</ul>
                    <div class="details_plzx">
                        <!-- <span class="colorF"><a id="ProductDetails_hpkProductReviews" class="Product_b" href="LookProductReviews.aspx?productId=1572">查看全部52条评论</a></span> -->
                        <a class="Product_a" href="/login.aspx?ReturnUrl=/product_detail-1572.aspx" style="display:none;">请先登录</a>
                    </div>
                </div>

                <div class="product_mc" style="display:none">
                    
<table class="tab_sales">
<tr class="tr_head">
<td>买家</td><td>数量</td><td>付款时间</td><td>款式和型号</td>
</tr>

<tr>
<td>W**2</td>
<td>1</td>
<td>2016/2/4 22:39:12</td>
<td>&nbsp;</td>
</tr>

<tr>
<td>W**0</td>
<td>1</td>
<td>2016/2/3 9:11:21</td>
<td>&nbsp;</td>
</tr>

<tr>
<td>1**9</td>
<td>1</td>
<td>2016/2/2 9:48:10</td>
<td>&nbsp;</td>
</tr>

<tr>
<td>Q**3</td>
<td>1</td>
<td>2016/2/2 9:27:47</td>
<td>&nbsp;</td>
</tr>

<tr>
<td>W**8</td>
<td>1</td>
<td>2016/2/1 14:33:21</td>
<td>&nbsp;</td>
</tr>

<tr>
<td>2**1</td>
<td>1</td>
<td>2016/2/1 2:13:10</td>
<td>&nbsp;</td>
</tr>

</table>
                    <div class="details_plzx">
                        <span class="colorF"><a id="ProductDetails_hpkProductSales" class="Product_b" href="LookLineItems.aspx?productId=1572">查看全部6498条成交记录</a></span>
                    </div>
                </div>

                <div class="product_mc" style="display:none">
                    <!--商品咨询-->
                    
                    <div class="details_plzx">
                        <span class="colorF"><a id="ProductDetails_hpkProductConsultations" class="Product_b" href="ProductConsultationsAndReplay.aspx?productId=1572">查看全部0条咨询</a></span>
                        <a class="Product_a" href="/ProductConsultations.aspx?ProductId=1572">我要咨询</a>
                    </div>
                </div>

            </div>
            <script type="text/javascript">
                var number = $("#buyAmount");
                var theme = "disabled";
                $(function () {
					//没有库存 时  给 图片 添加 枯竭 印记
                    var stNum = $("#productDetails_Stock").text();
					if(isNaN(stNum)){
						stNum = 0;
					}else{
						stNum = parseInt(stNum);
					}
					if (stNum == 0)
					{
					    number.attr(theme, theme);
					    number.val(0);

					} else {
					    number.removeAttr(theme);
					}
					if(!stNum){
						$("<div class='emp'></div>").appendTo(".zoom-small-image");
					}
                    var imgsrc = $("#ProductDetails_productImg").attr("src");
                    if (imgsrc == undefined || imgsrc == "" || imgsrc == null) {
                        $(".gd-code-wrap").css("display", "none");
                    } else {
                        if (Number($("#productDetails_Stock").text()) == 0) {
                        } else {
                            $(".gd-code-wrap").css("display", "");
                        }
                    }
 
                    if (number.val() >= parseInt($("#productDetails_Stock").text())) {
                        $('div[name="spAdd"]').addClass(theme);
                    }
                    $('div[name="spAdd"]').bind("click", function () {
                        if ($(this).hasClass(theme)) {
                            return;
                        }
                        var stock = parseInt($("#productDetails_Stock").text());
                        var val = number.val();
                        if (isNaN(val) || val == "") {
                            val = 1;
                        }
                        var num = parseInt(val) + 1;
                        var $btnSub = $('div[name="spSub"]');
                        if (num <= stock) {
                            number.val(num).attr("old-v", num);
                            ChangeBuyAmount();
                            if (num > 1) {
                                $btnSub.removeClass(theme);
                            }
                            if (num == stock) {
                                $(this).addClass(theme);
                            }
                        }
                    });
                    $('div[name="spSub"]').bind("click", function () {
                        if ($(this).hasClass(theme)) {
                            return;
                        }
                        var stock = parseInt($("#productDetails_Stock").text());
                        var $btnAdd = $('div[name="spAdd"]');
                        var val = number.val();
                        if (isNaN(val) || val == "") {
                            val = 1;
                        }
                        var num = parseInt(val) - 1;
                        if (num >= 1) {
                            number.val(num).attr("old-v", num);
                            ChangeBuyAmount();
                            if (num == 1) {
                                $(this).addClass(theme);
                            }
                            if (num < stock) {
                                $btnAdd.removeClass(theme);
                            }
                        }
                    });

                    $(".product_nav_wrap li").click(function () {
                        var li_index = $(".product_nav_wrap li").index(this);
                        $(".product_mc").hide().eq(li_index).show();
                        $(this).addClass("curr").siblings().removeClass("curr");
                    });
                });
            </script>
            <!-- <script src="/shop/templates/haidao/js/product.helper.js" type="text/javascript"></script> -->
            <div class="clearboth"></div>
            <!-- 相关商品-->
        </div>
    </div>
</div>
<script>
    $(function(){
        // 加入购物车
        $('a[nctype="addcart_submit"]').click(function(){
            addcart(<?php echo $output['goods']['goods_id'];?>, checkQuantity(),'addcart_callback');
        });
        // 立即购买
        $('a[nctype="buynow_submit"]').click(function(){
            buynow(<?php echo $output['goods']['goods_id']?>,checkQuantity());
        });
        // 验证购买数量
        function checkQuantity(){
            var quantity = parseInt($("#buyAmount").val());
            if (quantity < 1) {
                alert("<?php echo $lang['goods_index_pleaseaddnum'];?>");
                $("#buyAmount").val('1');
                return false;
            }
            max = parseInt($('[nctype="goods_stock"]').text());
            <?php if ($output['goods']['is_virtual'] == 1 && $output['goods']['virtual_limit'] > 0) {?>
            max = <?php echo $output['goods']['virtual_limit'];?>;
            if(quantity > max){
                alert('最多限购'+max+'件');
                return false;
            }
            <?php } ?>
            <?php if (!empty($output['goods']['upper_limit'])) {?>
            max = <?php echo $output['goods']['upper_limit'];?>;
            if(quantity > max){
                alert('最多限购'+max+'件');
                return false;
            }
            <?php } ?>
            if(quantity > max){
                alert("<?php echo $lang['goods_index_add_too_much'];?>");
                return false;
            }
            return quantity;
        }
        // 立即购买js
        // function buynow(goods_id,quantity){
        //     <?php if ($_SESSION['is_login'] !== '1'){?>
        //         login_dialog();
        //     <?php }else{?>
        //         if (!quantity) {
        //             return;
        //         }
        //         <?php if ($_SESSION['store_id'] == $output['goods']['store_id']) { ?>
        //         alert('不能购买自己店铺的商品');return;
        //         <?php } ?>
        //         $("#cart_id").val(goods_id+'|'+quantity);
        //         $("#buynow_form").submit();
        //     <?php }?>
        // }
        /* 加入购物车后的效果函数 */
        function addcart_callback(data){
            $('#bold_num').html(data.num);
            $('#bold_mly').html(price_format(data.amount));
            $('.ncs-cart-popup').fadeIn('fast');
        }
    })
    $(function(){
        //评价列表
        $('#all-comments-title').on('click', 'li', function() {
            $('#all-comments-title li').removeClass('cur');
            $(this).addClass('cur');
            load_goodseval($(this).attr('data-type'));
        });
        load_goodseval('all');
        function load_goodseval(type) {
            var url = '<?php echo urlShop('goods', 'comments', array('goods_id' => $output['goods']['goods_id']));?>';
            url += '&type=' + type;
            $("#goodseval").load(url, function(){
                $(this).find('[nctype="mcard"]').membershipCard({type:'shop'});
            });
        }

        // $('.side_nav').hover(function(){
        //     $('.my_left_category').show();
        // },function(){
        //     $('.my_left_category').hide();
        // }) 
    })
</script>
<?php }?>